/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.acargil.sudoku.view.util;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Oguzhan
 */
public class MessageFactory {

    /**
     * Show error message
     */
    public static void errorMessage(String message) {
        JOptionPane.showMessageDialog(new JFrame(), message, "Error",
                JOptionPane.ERROR_MESSAGE);
    }

    /**
     * Show warning message
     * */
    public static void warningMessage(String message) {
        JOptionPane.showMessageDialog(new JFrame(), message, "Warning",
                JOptionPane.WARNING_MESSAGE);
    }

    /**
     * Show information message
     * */
    public static void informationMessage(String message) {
        JOptionPane.showMessageDialog(new JFrame(), message, "Info",
                JOptionPane.INFORMATION_MESSAGE);
    }

    /**
     * Show information message with title
     * */
    public static void informationMessage(String message, String title) {
        JOptionPane.showMessageDialog(new JFrame(), message, title,
                JOptionPane.INFORMATION_MESSAGE);
    }
    
    /**
     * Take simple input...
     * */
    public static String inputDialog(String message, String title) {
        String s = (String) JOptionPane.showInputDialog(new JFrame(), title, message,
                JOptionPane.PLAIN_MESSAGE, null, null, null);

        return s;
    }

    /**
     * @return returns true, if 'yes' button is pressed.
     * */
    public static boolean yesNoDialog(String message, String title) {
        int press = JOptionPane.showConfirmDialog(new JFrame(), message, title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        return press == 0;
    }
}
